/***********************************************************
* Purpose : update the Question 
* Author : NuoiNV
* Date: 19/1/2012
* Description: update the Question
*/
IF EXISTS ( SELECT * FROM SYSOBJECTS WHERE NAME = 'sp_UpdateQuestion' ) 
BEGIN
	DROP PROC sp_UpdateQuestion
END
GO
CREATE PROC sp_UpdateQuestion
	@ID			int,
	@Category_ID int,
	@Content	NVARCHAR(max),
	@Status int,
	@RESULT	INT OUTPUT
AS
BEGIN 
	DECLARE @Last_Update	DATETIME
	SET @Last_Update = GETDATE()
	IF EXISTS (SELECT * FROM Question  WHERE ID = @ID)
	Begin
		UPDATE Question 
			
			SET [Category_ID] = @Category_ID,[Content] = @Content,Status=@Status, Last_Update=@Last_Update  from Question where ID=@ID
			SET @RESULT = 1
	End
	Else
		Begin
			SET @RESULT = 0
		End
END 